<template>
  <div>
    <el-dialog v-bind="$attrs" v-on="$listeners" @open="onOpen" @close="onClose" title="选择实验室">
      <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px">
        <el-form-item label="选择实验室编号" prop="lab_number">
          <el-select v-model="formData.lab_number" placeholder="请选择选择实验室编号" clearable
            :style="{width: '100%'}"></el-select>
        </el-form-item>
        <el-form-item label="实验室名字" prop="lab_name">
          <el-input v-model="formData.lab_name" placeholder="请输入实验室名字" readonly :style="{width: '100%'}">
          </el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="close">取消</el-button>
        <el-button type="primary" @click="handleConfirm">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  inheritAttrs: false,
  components: {},
  props: [],
  data() {
    return {
      formData: {
        lab_number: undefined,
        lab_name: undefined,
      },
      rules: {
        lab_number: [{
          required: true,
          message: '请选择选择实验室编号',
          trigger: 'change'
        }],
        lab_name: [],
      },
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    onOpen() {},
    onClose() {
      this.$refs['elForm'].resetFields()
      this.$emit("labSelectFinish",this.formData.lab_name,this.formData.lab_number,)
    },
    close() {
      this.$emit('update:visible', false)
    },
    handleConfirm() {
      this.$refs['elForm'].validate(valid => {
        if (!valid) return;
        this.close()
      })
    },
  }
}

</script>
<style>
</style>
